#include "SWebView.h"
#include <QWebEngineView>
#include <QWebEnginePage>
#include <QWebEngineSettings>
#include "SWebWidget.h"

QbWebView::QbWebView(QWidget* parent)
	: QWebEngineView(parent)
{
	settings()->setUnknownUrlSchemePolicy(QWebEngineSettings::AllowAllUnknownUrlSchemes);
	settings()->setAttribute(QWebEngineSettings::PdfViewerEnabled, true);
	settings()->setAttribute(QWebEngineSettings::PluginsEnabled, true);
	settings()->setAttribute(QWebEngineSettings::JavascriptCanOpenWindows, true);
	settings()->setAttribute(QWebEngineSettings::AllowRunningInsecureContent, true);
}

QbWebView::~QbWebView()
{

}
QWebEngineView* QbWebView::createWindow(QWebEnginePage::WebWindowType type)
{
	SWebWidget* window = new SWebWidget("Popup", "", nullptr);
	window->setAttribute(Qt::WA_DeleteOnClose);
	window->resize(600, 600);
	window->show();
	return window->view();
}